package com.ssh.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ssh.entity.Product;
import com.ssh.service.ProductService;

@Controller
@RequestMapping("/product")
public class ProductController {

	@Autowired
	private ProductService ps;

	@RequestMapping(value = "/show.do")
	public String show(HttpServletRequest req, HttpServletResponse rsp) {
		Integer pid = Integer.parseInt(req.getParameter("pid"));
//		System.out.println(pid);
		Product product = ps.show(pid);
		
		req.setAttribute("bean", product);
		
		return "productIntroduction";
	}
}
